package com.swq.java.code.chapter13.code11;

public class Sleeper extends Thread {
    public void run() {
        try {
            sleep(60000);  //睡眠1分钟
            System.out.println("sleep over");
        } catch (InterruptedException e) {
            System.out.println("sleep interrupted");
        }
        System.out.println("end");
    }

    public static void main(String[] args) throws Exception {
        Sleeper sleeper = new Sleeper();
        sleeper.start();
        Thread.sleep(10);
        sleeper.interrupt();  //中断Sleeper线程的睡眠
    }
}